package com.tlw.leave.controller;

import com.tlw.leave.entity.Student;
import com.tlw.leave.service.StudentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StudentController {
    @Autowired
    private StudentService studentService;

    @ApiOperation(value="学生添加")
    @RequestMapping(value = "/saveStudent",method = RequestMethod.POST)
    public Student saveStudent(Student students){

        Student student = studentService.saveStudent(students);
        return student;

    }

    @ApiOperation(value="显示全部")
    @RequestMapping(value = "finadll",method = RequestMethod.GET)
    public List<Student> finadll(){
        return studentService.finadallStudent();
    }
}
